package com.idata.service.services;

import cn.hutool.core.collection.ListUtil;
import com.idata.model.request.RelationRequest;
import com.idata.model.response.RelationResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class RelationService {

    @Autowired
    private CitizenInfoService citizenInfoService;

    public RelationResponse relation(RelationRequest relationRequest) {
        String srcIdCard = relationRequest.getSrcIdCard();
        String dstIdCard = relationRequest.getDstIdCard();
        List<String> relationShip = citizenInfoService.proxyGetRelationTagMap(srcIdCard, ListUtil.toList(dstIdCard)).getOrDefault(dstIdCard, new ArrayList<>());
        return new RelationResponse().setRelationshipList(relationShip);
    }
}
